草庐IT

Android ProGuard +MultiDex 导致 ClassNotFoundException

全部标签

c++ - 为什么在使用 std::map::insert() 时编译顺序有时会导致段错误?

我有一个类叫做Controller,在其中,我有一个名为Button的类.Controller包含几个Button不同类型的实例(例如button_type_a、button_type_b)。controller.h#ifndef__controller__#define__controller__classController{public:classButton{public:Button(inttype=-1);private:inttype;};Controller();ButtonA;ButtonB;ButtonX;ButtonY;};#endif按钮类型为ints,我希望能

c++ - 将 QUrl 传递给 QNetworkRequest 构造函数会导致 "non-class type"编译器错误

当我将QUrl传递给QNetworkRequest构造函数时,我从编译器中得到了奇怪的错误。更奇怪的是它只发生在特定的情况下,举个例子:#include#includeintmain(intargc,char*argv[]){QCoreApplicationa(argc,argv);QStringstr;QNetworkRequestreq(QUrl(str));req.setUrl(QUrl(str));//error:requestformember'setUrl'in'req',whichisofnon-classtype'QNetworkRequest()(QUrl)'QNet

c++ - 由于在 32 位的 G++ 4.4.7 20120313 中使用 C++ std::vector 中的内联函数导致精度发生变化

我正在centos5.932位(在64位机器上运行)上编译,目标是32位。g++版本为4.4.7,这不是centos5.9上默认提供的版本,但可以使用yum下载并作为发行版的一部分提供。我有一个非常简单的循环如下std::vectorresult(n);std::vectorvalues(n);//hereIcomputevalues().TheyarecorrectandIextensivelynoted//thatthere'snothingwrongthere.Theproblemishereresult[0]=0.0;for(inti=0;i在此代码的更复杂版本中(它显示了完全

c++ - 导致 C++11 std::mutex 将阻塞的线程锁定为被动等待状态?

我有以下情况:两个C++11线程正在计算,它们通过std::mutex同步。线程A锁定互斥锁,直到数据准备好供线程B执行的操作使用。当互斥量解锁时,线程B开始工作。线程B试图锁定互斥量并被阻塞,直到它被线程A解锁。voidThreadA(std::mutex*mtx,char*data){mtx->lock();//dosomethingusefulwithdatamtx->unlock();}voidThreadB(std::mutex*mtx,char*data){mtx->lock();//waituntilThreadAisready//dosomethingusefulwit

C++11 constexpr 导致编译器的内部错误 (C1001)

我正在使用VisualStudio2015Update3。我得到一个fatalerror:(codeC1001):Aninternalerrorhasoccurredinthecompiler.代码如下:templateconstexprTepsilon=std::numeric_limits::epsilon();我读到它已在VisualStudioUpdate2中修复。有人可以解释我为什么会收到此错误吗?提前致谢。 最佳答案 任何内部错误(ICE)都是编译器错误。你得到它是因为你碰巧触发了那个错误。对于此编译器,您可以在Micr

c++ - 为什么这个无锁堆栈类中的 'deleting' 节点会导致竞争条件?

在AnthonyWilliams的《C++ConcurrencyinAction》一书中,第7.2.1节列出了一个无锁堆栈实现:templateclasslock_free_stack{structnode{shared_ptrdata_;node*next_;node(constT&data):data_(make_shared(data)){}};atomichead_;public:voidpush(constT&data){node*new_node=newnode(data);new_node->next_=head_.load();while(!head.compare_e

c++ - 使用尚未定义的参数的 unique_ptr 实例化不会导致错误

#includeclassData;std::unique_ptrp;//classData{};//notworkingwithoutthisintmain(){}用g++-5编译这段代码会出现这样的错误:“sizeof”对不完整类型“Data”的无效应用有人可以解释为什么如果我取消注释第4行编译会成功吗?据我所知,在第3行编译器没有关于数据类型的完整信息。我们在这一行中只有前向声明。真正的声明出现在第4行。 最佳答案 unique_ptr类型的目标类型在模板实例化时可能不完整,但在unique_ptr可能尝试处理存储的指针时必须

c++ - 保留容量会导致两次分配还是一次分配?

std::vectorvec;//line#1vec.reserve(100);//line#2我想知道第1行是否触发了一个小的分配(例如,10Ts的内存),或者第一个分配是否发生在第2行。标准对此有任何说明吗? 最佳答案 它是实现定义的。vector的默认构造函数不需要分配任何东西,但实现这样做是允许的。 关于c++-保留容量会导致两次分配还是一次分配?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.co

c++ - std::move 会导致切片吗?

例如,在unique_ptr=newderiv;std::vector>.push_back(std::move(deriv));将deriv切片为类型unique_ptr? 最佳答案 不会发生切片;unique_ptr将拥有指向Derived的指针对象。Aunique_ptr派生类可以隐式转换为unique_ptr到基类。 关于c++-std::move会导致切片吗?,我们在StackOverflow上找到一个类似的问题: https://stackover

c++ - __cdecl 导致比 __stdcall 更大的可执行文件?

我发现了这个:Becausethestackiscleanedbythecalledfunction,the__stdcallcallingconventioncreatessmallerexecutablesthan__cdecl,inwhichthecodeforstackcleanupmustbegeneratedforeachfunctioncall.假设我有两个函数:void__cdeclfunc1(intx){//dosomestuffusingx}void__stdcallfunc2(intx,inty){//dosomestuffusingx,y}在main()中:in